/*
 * Copyright 2019 Flipkart Internet Pvt. Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.flipkart.ohos.proteus.toolbox;

import ohos.agp.components.Component;

import com.flipkart.ohos.proteus.DataContext;
import com.flipkart.ohos.proteus.ProteusContext;
import com.flipkart.ohos.proteus.ProteusView;
import com.flipkart.ohos.proteus.value.Layout;
import com.flipkart.ohos.proteus.value.ObjectValue;

/**
 * ManagerWrapper
 * <p>
 * Proxies the implementation of {@link ProteusView.Manager} that simply delegates
 * all of its calls to another Manager. Can be subclassed to modify or to add new behavior
 * without changing the original Manager.
 * </p>
 *
 * @author adityasharat
 */
public class ManagerWrapper implements ProteusView.Manager {
    private final ProteusView.Manager base;

    public ManagerWrapper(ProteusView.Manager base) {
        this.base = base;
    }

    @Override
    public void update(ObjectValue data) {
        base.update(data);
    }

    @Override
    public Component findViewById(String id) {
        return base.findViewById(id);
    }

    @Override
    public ProteusContext getContext() {
        return base.getContext();
    }

    @Override
    public Layout getLayout() {
        return base.getLayout();
    }

    @Override
    public DataContext getDataContext() {
        return base.getDataContext();
    }

    @Override
    public Object getExtras() {
        return base.getExtras();
    }

    @Override
    public void setExtras(Object extras) {
        base.setExtras(extras);
    }

    public ProteusView.Manager getBaseManager() {
        return base;
    }
}
